package com.bq.server.base;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.SuperBuilder;

import java.time.LocalDateTime;

/**
 * 创建时使用的字段
 *
 * @author: ChenSH
 * @date: Create by in 08:21 2019-09-18
 */
@Data
@SuperBuilder
@EqualsAndHashCode(callSuper = true)
public abstract class CreatedEntity<T extends CreatedEntity<T>> extends IdEntity<T> {

    /**
     * 创建人
     */
    @TableField(fill = FieldFill.INSERT)
    private String createdBy;

    /**
     * 创建时间
     */
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createdDate;

    public CreatedEntity(Long id, String createdBy, LocalDateTime createdDate) {
        super(id);
        this.createdBy = createdBy;
        this.createdDate = createdDate;
    }

    public CreatedEntity() {
    }
}
